/*
 ============================================================================
 Name		: TradeFundEntrustWithdrawal.h
 Author	  : spring xu
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeFundEntrustWithdrawal declaration
 ============================================================================
 */

#ifndef TRADEFUNDENTRUSTWITHDRAWAL_H
#define TRADEFUNDENTRUSTWITHDRAWAL_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TableWidget.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeFundEntrustWithdrawal: public CTradeBlock, public MWidgetObserver, public MPushButtonObserver//,public MReqObserver
{
public:
    ~CTradeFundEntrustWithdrawal();

    static CTradeFundEntrustWithdrawal* NewL(CBaseBlock* bsBack);

    static CTradeFundEntrustWithdrawal* NewLC(CBaseBlock* bsBack);

private:
    CTradeFundEntrustWithdrawal(CBaseBlock* bsBack);

    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);
    
    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseMove(const TPoint& aPt);

    void OnMouseUp(const TPoint& aPt);

    void SizeChanged();    
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
    void BeforeBack();
    
    void InitNetworkData();
    
private:
    void CreateControls();

	void LayoutControls();
    
protected:
    void AddTabs();

    void BeforeDraw(CFbsBitGc& g) const;
        
public:
    // from MWidgetObserver
    void UpdateScreen();
    
    void SelectOneRow(TInt aRowIndex);
    
    void LoseFocus(const TInt& keycode);
    
public: //MPushButtonObserver
    void PushButtonClicked();
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);
	
private:
	void CreateTable();
	TBool AppendNetworkData(__ofOrder_info_t* p_ofOrderArray);
	
private:
	enum TNetworkStatus
	{
		ENetworkStatus_None,
		ENetworkStatus_ReqData,
		ENetworkStatus_ReqWithdrawal,
		ENetworkStatus_Resp,
	};
private:
    CTableWidget* iTable;
    
    CPushButton* iButtonCancel;
    CPushButton* iButtonMore;
    
    TInt	iFocusControl;
    TInt	iNetworkStatus;
    TInt	iNumberOfElement;
    TBool	iCanReq;
};

#endif // TRADEBLOCKQUERYFUNDS_H
